|
RAIS
3.2
|
00001 using System; 00002 using System.Data; 00003 using System.Configuration; 00004 using System.Collections; 00005 using System.Collections.Generic; 00006 using System.Web; 00007 using System.Web.Security; 00008 using System.Web.UI; 00009 using System.Web.UI.WebControls; 00010 using System.Web.UI.WebControls.WebParts; 00011 using System.Web.UI.HtmlControls; 00012 00013 using RAIS.UI.Common; 00014 00015 namespace RAIS.UI.SpecificMasks.Controls 00016 { 00017 public partial class MultiLookupFieldControl : System.Web.UI.UserControl 00018 { 00019 //********************************************************************* 00020 #region Fields 00021 bool nonCompliance = false; 00022 #endregion 00023 //********************************************************************* 00024 #region Properties 00025 public bool NonCompliance 00026 { 00027 get { return this.nonCompliance; } 00028 set { this.nonCompliance = value; } 00029 } 00030 public DropDownList NonComplianceMajorCategoryDDL 00031 { 00032 get { return this.DDLmajorCategory; } 00033 } 00034 public DropDownList NonComplianceCategoryDDL 00035 { 00036 get { return this.DDLcategory; } 00037 } 00038 public ListBox SourceListBox 00039 { 00040 get { return this.lstSource; } 00041 } 00042 public ListBox TargetListBox 00043 { 00044 get { return this.lstTarget; } 00045 } 00046 public bool Enabled 00047 { 00048 set 00049 { 00050 this.TDfirstcell0.Visible = value; 00051 this.TDfirstcell1.Visible = value; 00052 this.TDsecondcell0.Visible = value; 00053 this.TDsecondcell1.Visible = value; 00054 this.TDthirdcell0.Attributes[Constants.ATTRIBUTE_CLASS_NAME] = 00055 (value) ? Constants.CSS_CLASS_MULTILOOKUP_ENABLED_COLUMN : Constants.CSS_CLASS_MULTILOOKUP_DISABLED_COLUMN; 00056 this.TDthirdcell1.Attributes[Constants.ATTRIBUTE_CLASS_NAME] = 00057 (value) ? Constants.CSS_CLASS_MULTILOOKUP_ENABLED_COLUMN : Constants.CSS_CLASS_MULTILOOKUP_DISABLED_COLUMN; 00058 this.LBLselected.Enabled = value; 00059 this.lstTarget.Enabled = true; 00060 00061 this.SetEnabledNonCompliance(value); 00062 } 00063 } 00064 public int SelectedNonComplianceMajorCategoryID 00065 { 00066 get 00067 { 00068 Dictionary<string, int> majorCategories = 00069 UI.Common.DynamicMaskManagement.GetNonComplianceMajorCategories(this.Page, false); 00070 if (majorCategories != null && majorCategories.ContainsKey(this.DDLmajorCategory.SelectedValue)) 00071 return majorCategories[this.DDLmajorCategory.SelectedValue]; 00072 else 00073 return 0; 00074 } 00075 } 00076 public int SelectedNonComplianceCategoryID 00077 { 00078 get 00079 { 00080 Dictionary<string, int> nonComplianceCategories = 00081 UI.Common.DynamicMaskManagement.GetNonComplianceCategories(this.Page, this.SelectedNonComplianceMajorCategoryID, false); 00082 if (nonComplianceCategories != null && nonComplianceCategories.ContainsKey(this.DDLcategory.SelectedValue)) 00083 return nonComplianceCategories[this.DDLcategory.SelectedValue]; 00084 else 00085 return 0; 00086 } 00087 } 00088 #endregion Properties 00089 //********************************************************************* 00090 #region Event handlers 00091 protected void Page_Load(object sender, EventArgs e) 00092 { 00093 } 00094 protected void Page_Init(object sender, EventArgs e) 00095 { 00096 if (this.Page.Session["IsRightToLeft"] != null && (bool)this.Page.Session["IsRightToLeft"]) 00097 { 00098 foreach (Control control in this.Controls) 00099 if (control is HtmlControl && ((HtmlControl)control).Attributes["href"] != null && ((HtmlControl)control).Attributes["href"].IndexOf("rais1.css") != -1) 00100 ((HtmlControl)control).Attributes["href"] = ((HtmlControl)control).Attributes["href"].Replace("rais1.css", "rais1-rtl.css"); 00101 } 00102 //PageManagement.SetScrolableListBox(this.lstSource, this.Page, true); 00103 //PageManagement.SetScrolableListBox(this.lstTarget, this.Page, true); 00104 } 00105 protected void DDLmajorCategory_SelectedIndexChanged(object sender, EventArgs e) 00106 { 00107 UI.Common.DynamicMaskManagement.InitializeNonComplianceCategories(this.DDLcategory, this.SelectedNonComplianceMajorCategoryID); 00108 } 00109 00110 protected void btnAdd_Click(object sender, EventArgs e) 00111 { 00112 MoveListItem(lstSource, lstTarget); 00113 } 00114 00115 protected void btnRemove_Click(object sender, EventArgs e) 00116 { 00117 MoveListItem(lstTarget, lstSource); 00118 } 00119 00120 protected void MoveListItem(ListBox lstFrom, ListBox lstTo) 00121 { 00122 foreach (ListItem listItem in lstFrom.Items) 00123 if (listItem.Selected) 00124 { 00125 lstTo.Items.Add(listItem); 00126 } 00127 for (int i = lstFrom.Items.Count - 1; i >= 0; i-- ) 00128 if (lstFrom.Items[i].Selected) 00129 { 00130 lstFrom.Items.Remove(lstFrom.Items[i]); 00131 } 00132 foreach (ListItem listItem in lstTo.Items) 00133 listItem.Selected = false; 00134 00135 UI.Common.PageManagement.InitializeListboxTooltips(lstFrom); 00136 UI.Common.PageManagement.InitializeListboxTooltips(lstTo); 00137 } 00138 #endregion Event handlers 00139 //********************************************************************* 00140 #region Private methods 00141 void SetEnabledNonCompliance(bool enabled) 00142 { 00143 this.DDLmajorCategory.Visible = enabled && this.nonCompliance; 00144 this.LBLmajorCategory.Visible = this.DDLmajorCategory.Visible; 00145 this.DDLcategory.Visible = enabled && this.nonCompliance; 00146 this.LBLcategory.Visible = this.DDLcategory.Visible; 00147 00148 if (enabled && this.DDLmajorCategory.Items.Count == 0) 00149 { 00150 UI.Common.DynamicMaskManagement.InitializeNonComplianceMajorCategories(this.DDLmajorCategory); 00151 } 00152 } 00153 #endregion 00154 } 00155 }